import request from '@/utils/request'

import qs from 'qs';

//获取我的所有的课程
export function getMyCourses(data){
  return request({
    url:'/course/getMyCourses',
    method:'post',
    data:data
  })
}
//获取我参与的课程
export function getMyPartInCourses(data){
  return request({
    url:'/course/getMyPartInCourses',
    method:'post',
    data:data
  })
}

export function createCourseName(data) {
  return request({
    url:'/course/saveCourseName',
    method:'post',
    data:data
  })
}

export function getKnowledgeNode(data){
  return request({
    url:'/teach/knowledge_points/tree?courseId='+data.courseId,
    method:'get'
  })
}

//修改知识点

export function updateKnowledgeNode(data){
  return request({
    url:'/teach/knowledge_points',
    method:'put',
    data:data
  })
}
//添加知识点
export function createKnowledgeNode(data){
  return request({
    url:'/teach/knowledge_points',
    method:'post',
    data:data
  })
}

//删除知识点
export function deleteKnowledgeNode(id){
  return request({
    url:'/teach/knowledge_points/'+id,
    method:'delete'
  })
}

//-------------课程章节管理----------
//获取当前课程的所有章节数据
export function getChapters(cId){
  return request({
    url:'/teach/chapter/tree?courseId='+cId,
    method:'get'
  })
}
//修改课程章节数据
export function updateChapter(data){
  return request({
    url:'/teach/chapter',
    method:'put',
    data:data
  })
}
//添加课程章节数据
export function createChapter(data){
  return request({
    url:'/teach/chapter',
    method:'post',
    data:data
  })
}
//删除课程章节数据
export function deleteChapter(cId){
  return request({
    url:'/teach/chapter/'+cId,
    method:'delete'
  })
}
//----------添加视频-----------
//----------添加测试-----------
//----------关联知识点-----------
//获取关联知识点
export function getKnowrel(data){
  return request({
    url:'/teach/chapter_knowledge_points/list',
    params:data,
    method:'get'
  })
}
//添加知识点
export function relevanceknow(data){
  return request({
    url:'/teach/chapter_knowledge_points',
    method:'post',
    data:data
  })
}
//修改关联知识点
export function uprelknow(data){
  return request({
    url:'/teach/chapter_knowledge_points',
    method:'put',
    data:data
  })
}
//----------添加资料-----------
//获取资料
export function getfile(data){
  return request({
    url:'/teach/chapter_material/files',
    params:data,
    method:'get'
  })
}
//添加资料
export function createfile(data){
  return request({
    url:'/teach/material',
    data:data,
    method:'post'
  })
}
//关联资料
export function relfile(data){
  return request({
    url:'/teach/chapter_material',
    data:data,
    method:'post'
  })
}
//----------添加讨论-----------



//-------------课程相关教师管理----------
//添加老师
export function createTeacher(data){
  return request({
    url:'/teach/speakers',
    method:'post',
    data:data
  })
}

export function updateTeacher(data){
  return request({
    url:'/teach/speakers',
    method:'put',
    data:data
  })
}

export function deleteTeacher(data){
  console.log(data)
  return request({
    url:'/teach/speakers/'+data.id,
    method:'delete'
  })
}
export function getTeachers(data){
  return request({
    url:'/teach/speakers/list',
    method:'get',
    params:data
  })
}
//-------------课程时间规划管理----------
export function getTimePlan(data){
  return request({
    url:'/teach/chapter_plan/chapterPlan',
    method:'get',
    params:data
  })
}
//-------------课程属性管理----------
//获取属性
export function getAttrbute(data){
  return request({
    url:'/teach/course_attribute/attrbute',
    method:'get',
    params:data
  })
}
//修改属性
export function updateAttrbute(data) {
  return request({
    url: '/teach/course_attribute',
    method: 'put',
    data: data
  })
}

//-------------课程属性管理----------
//查询考核标准
export function getCheck(data){
  return request({
    url:'/teach/check/getcheck',
    method:'get',
    params:data
  })
}
//添加
export function createCheck(data){
  return request({
    url:'/teach/check',
    method:'post',
    data:data
  })
}
//修改
export function updateCheck(data){
  return request({
    url:'/teach/check',
    method:'put',
    data:data
  })
}







